#include <iostream>
#include "Shm.hpp"
#include "NamePipe.hpp"

void ServerWork(Shm& shm)
{
    char *addr = (char *)shm.GetShmAddr();
    // 建立管道
    NamePiped fifo(pathname, Creator);
    fifo.OpenForRead();
    // server开始读取client的数据
    while (true)
    {
        std::string MessageTip;
        fifo.ReadPipeData(&MessageTip);
        std::cout << "server content: " << addr << std::endl;
        sleep(1);
    }
}
int main()
{
    Shm shm(static_path, Proj_id, Creator);
    shm.CleanShm();
    ServerWork(shm);
    return 0;
}